<?php
define("EW_PAGE_ID", "index", TRUE); // Page ID
?>
<?php 
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "osj-ewcfg50.php" ?>
<?php include "osj-ewmysql50.php" ?>
<?php include "osj-phpfn50.php" ?>
<?php include "osj-osj2dusersinfo.php" ?>
<?php include "osj-userfn50.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Open connection to the database
$conn = ew_Connect();
?>
<?php
$Security = new cAdvancedSecurity();
?>
<?php

// Common page loading event (in userfn*.php)
Page_Loading();
?>
<?php
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
$Security->LoadUserLevel(); // load User Level
	Page_Terminate("osj-osj2dpostslist.php"); // Exit and go to default page
if ($Security->AllowList('osj-applications')) {
	Page_Terminate("osj-osj2dapplicationslist.php");
}
if ($Security->AllowList('osj-resumes')) {
	Page_Terminate("osj-osj2dresumeslist.php");
}
if ($Security->AllowList('osj-users')) {
	Page_Terminate("osj-osj2duserslist.php");
}
if ($Security->AllowList('osj-user_detail')) {
	Page_Terminate("osj-osj2duser_detaillist.php");
}
if ($Security->AllowList('osj-user_level')) {
	Page_Terminate("osj-osj2duser_levellist.php");
}
if ($Security->AllowList('osj-user_level_permissions')) {
	Page_Terminate("osj-osj2duser_level_permissionslist.php");
}
if ($Security->AllowList('osj-categories')) {
	Page_Terminate("osj-osj2dcategorieslist.php");
}
if ($Security->IsLoggedIn()) {
?>
You do not have the right permission to view the page
<br>
<a href="osj-logout.php">Back to Login Page</a>
<?php
} else {
	Page_Terminate("osj-login.php"); // Exit and go to login page
}
?>
<?php

// If control is passed here, simply terminate the page without redirect
Page_Terminate();

// -----------------------------------------------------------------
//  Subroutine Page_Terminate
//  - called when exit page
//  - clean up connection and objects
//  - if url specified, redirect to url, otherwise end response
function Page_Terminate($url = "") {
	global $conn;

	// Global page unloaded event (in userfn*.php)
	Page_Unloaded();

	 // Close Connection
	$conn->Close();

	// Go to url if specified
	if ($url <> "") {
		ob_end_clean();
		header("Location: $url");
	}
	exit();
}
?>
<?php
?>
